package com.htu.tax.controller;

import com.htu.tax.common.ResponseHelper;
import com.htu.tax.common.ResponseModel;
import com.htu.tax.payload.request.Invoice.addRequest;
import com.htu.tax.payload.request.Invoice.showRequest;
import com.htu.tax.payload.request.Invoice.update1Request;
import com.htu.tax.payload.request.Invoice.updateRequest;
import com.htu.tax.service.ITInvoiceService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

@Api(tags = "用户控制接口")
@RestController
@RequestMapping("/t-invoice")
@CrossOrigin
public class TInvoiceController {
    @Resource
    private ITInvoiceService service;

    @PostMapping(value = "/update")
    public ResponseModel updateState(@Valid @RequestBody updateRequest request) {

        service.updateState(request);
        return ResponseHelper.buildResponseModel("success");
    }

    @PostMapping(value = "/update1")
    public ResponseModel updateState1(@Valid @RequestBody update1Request request) {

        service.updateState1(request);
        return ResponseHelper.buildResponseModel("success1");
    }

    @PostMapping(value = "/addInvoice")
    public ResponseModel addInvoice(@RequestBody addRequest request) {
        return service.addInvoice(request);


    }

    @PostMapping(value = "/show")
    public ResponseModel show(@RequestBody showRequest request) {
        return ResponseHelper.buildResponseModel(service.show(request));


    }
}
